package imp.core.control;

import imp.core.data.PathData;
import imp.core.data.SettingsData;
import imp.core.data.songdata.SongData;
import imp.core.data.songhistory.SongHistoryData;


/**
 * The load manager loads the entire data into the program and initializes basis variables,
 * except the Session Data which is already initialized. 
 * @author Patrick Arnold
 * @since 08.09.2010
 *
 */
public class LoadManager {

	
	/**
	 * Loads the data and initializes basic variables so that the program can be run.
	 */
	public static void load() {
		
		boolean re;
				
		// Load the path data:
		re = PathData.loadData();
		if( !re) {
			abort();
		}
		
		// Load the settings data:
		re = SettingsData.loadData();
		if( !re) {
			abort();
		}
		
		// Load the song data:
		re = SongData.loadData();
		if( !re) {
			abort();
		}
		
		// Load the song history data:
		re = SongHistoryData.loadData();
		if( !re) {
			abort();
		}
		
		
	}
	
	
	
	/**
	 * Aborts the program if an error has occurred.
	 */
	private static void abort() {
		Exit.exit( false);
	}
	
	
}